package zj.chunan.menu.action;


import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONArray;
import zj.chunan.menu.dao.TreeNodeDao;
import zj.chunan.menu.model.TreeNode;

import com.opensymphony.xwork2.ActionSupport;

public class TreeNodeAction extends ActionSupport {
	

	private String tid;

	private String menuString;
	  
    private List<TreeNode> menus;
  
    public String execute() {
    	// 声明TreeNodeDao
		TreeNodeDao dao = new TreeNodeDao();

		menuString = dao.getPid("-100").toString();
		// 以下是通过 json的部分可以用 net.sf.json包或者gson包来写 
//        menus = new ArrayList<TreeNode>();
//      
//        TreeNode benz = new TreeNode();
//        benz.setText("Benz");
//        benz.setCls("folder");
//        benz.setLeaf(false);
//        benz.setTid(10);
//        menus.add(benz);
//      
//        
//        JSONArray jsonObject = JSONArray.fromObject(menus);
//        try {
//            menuString = jsonObject.toString();
//        } catch (Exception e) {
//            menuString = "ss";
//        }

        return "success";
    }

	public String getTid() {
		return tid;
	}



	public void setTid(String tid) {
		this.tid = tid;
	}



	public String getMenuString() {
        return menuString;
    }

    public void setMenuString(String menuString) {
        this.menuString = menuString;
    }

    
}
